home *** CD-ROM | disk | FTP | other *** search
/ Champak 128 / Vol 128 (Damaged).iso / games / scooby_d.swf / scripts / __Packages / com / ndimedia / ui / BitmapText.as < prev    next >
Encoding:
Text File  |  2011-03-26  |  1.3 KB  |  52 lines

  1. class com.ndimedia.ui.BitmapText extends com.ndimedia.ui.UIObject
  2. {
  3.    var m_scope;
  4.    var m_text;
  5.    var m_font;
  6.    var m_xoffset;
  7.    var m_yoffset;
  8.    var m_view;
  9.    function BitmapText(scope, text, font)
  10.    {
  11.       super();
  12.       this.m_scope = scope;
  13.       this.m_text = text;
  14.       this.m_font = font;
  15.       this.m_xoffset = 0;
  16.       this.m_yoffset = 0;
  17.       this.m_view = new com.ndimedia.containers.View(scope);
  18.       var _loc6_ = this.m_view.graphics;
  19.       var _loc5_ = 0;
  20.       while(_loc5_ < this.m_text.length)
  21.       {
  22.          var _loc3_ = this.m_text.charAt(_loc5_);
  23.          if(_loc3_ == "0" || _loc3_ == 0)
  24.          {
  25.             _loc3_ = "zero";
  26.          }
  27.          if(_loc3_ == "\n")
  28.          {
  29.             this.m_xoffset = 0;
  30.             this.m_yoffset += this.m_font.height;
  31.          }
  32.          else if(_loc3_ == " ")
  33.          {
  34.             this.m_xoffset += this.m_font.space + this.m_font.kerning;
  35.          }
  36.          else
  37.          {
  38.             var _loc4_ = this.m_font.draw(_loc6_,_loc3_);
  39.             _loc4_._x = this.m_xoffset;
  40.             _loc4_._y = this.m_yoffset;
  41.             this.m_xoffset += _loc4_._width + this.m_font.kerning;
  42.          }
  43.          _loc5_ = _loc5_ + 1;
  44.       }
  45.       this.m_view.show();
  46.    }
  47.    function move(x, y)
  48.    {
  49.       this.m_view.move(x,y);
  50.    }
  51. }
  52.